package com.haolijun.eecms.common;

import cn.hutool.json.JSONUtil;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;

/**
 * @ClassName TransitionUtils
 * @Description TODO
 * @Author hljstart
 * @Date 2023/3/14 22:23
 * @Version 1.0
 */
public class TransitionUtils {

    public static void arrayConversion(List<HashMap> list){
        for (HashMap map : list) {
            String imagesStr = (String) map.get("images");
            List<String> images = arrayConversion(imagesStr);
            map.put("images", images);
        }
    }

    public static List<String> arrayConversion(String jsonStr){
        if(jsonStr == null || "".equals(jsonStr)) {
            List<String> images = new ArrayList<String>();
            return images;
        }
        List<String> images = JSONUtil.toList(jsonStr, String.class);
        return images;
    }
}
